/**
 * Created by ROGSTAR on 2016/12/12.
 */

require.config(window.jshead);
require(['jquery', 'navigator'], function ($) {


    var _index=0;
    var navs=$('#stepNav').find('li');
    var len=navs.length;
    var otherClaaName='nav0 nav1 nav2 nav3 nav4';

    function changeStatus(addClassName,_index){
        navs.not(_index).removeClass(otherClaaName);
        navs.eq(_index).addClass(addClassName);
        var sliderPos=(-800)*_index+'px';
        $('#stepContent').css('left',sliderPos)
    }

        $('.pre').click(function () {
            _index--;
            if (_index < 0) {
                _index = len - 1;
            }
            var  addClassName='nav'+_index;
            changeStatus(addClassName,_index)
        });

        $('.next').click(function () {
            _index++;
            if (_index > len - 1) {
                _index = 0;
            }
            var  addClassName='nav'+_index;
            changeStatus(addClassName,_index)
        })
});